how to check sql connection in c